package org.c41.reflect;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DefaultInvocationHandler implements InvocationHandler{

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		Class<?> r = method.getReturnType();
		if(r==boolean.class){
			return false;
		}
		else if(r==long.class){
			return 0L;
		}
		else if(r==int.class){
			return 0;
		}
		else if(r==short.class){
			return (short)0;
		}
		else if(r==byte.class){
			return (byte)0;
		}
		else if(r==char.class){
			return (char)0;
		}
		else if(r==double.class){
			return 0.0;
		}
		else if(r==float.class){
			return 0.0f;
		}
		else{
			return null;
		}
	}

}
